<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            * {padding:0px;margin:0px;}
            .lbt {
                width: 500px;
                height: 180px;
                overflow: hidden;
                position: relative;
            }
            .lbt2 {
                width: 500px;
                height: 180px;
                overflow: hidden;
                position: relative;
            }
            .lbt img {width: 100%;height:100%;}
            .lbt2 img {width: 100%;height:100%;}

            ul {
                position: absolute;
                list-style: none;
                overflow: hidden;
                bottom: 5px;
                right: 0px;
            }
            ul li {
                float: left;
                width: 20px;
                height: 20px;
                margin-right: 10px;
                line-height: 20px;
                text-align: center;
                background-color: black;
                color: #fff;
                border-radius: 50%;
            }
            ul li:hover {
                background-color: orange;
                color: #fff;
                cursor: pointer;
            }
        </style>
    </head>
    <body>
        <div class="lbt">
            <img src="./img/img1.jpg" alt="">
        
            <ul>
                <li>1</li>
                <li>2</li>
                <li>3</li>
                <li>4</li>
                <li>5</li>
                <li>6</li>
            </ul>
        </div>

        <div class="lbt2">
            <img src="./img/img1.jpg" alt="">
        
            <ul>
                <li>1</li>
                <li>2</li>
                <li>3</li>
                <li>4</li>
                <li>5</li>
                <li>6</li>
            </ul>
        </div>


        <script>
            class lunbotu {
                constructor(el) {
                    // 同步配置文件
                    this.el = document.querySelector(el)
                    this.num = 1
                    this.timer = null
                    this.init()
                }
                init() {
                    //改变图片
                    this.gbtp()
                    //移入改变
                    this.yrgb()
                }
                
               
                //改变图片
                gbtp() {
                    this.timer = setInterval(() => {
                        let imgObj = this.el.querySelector('img')
                        this.num++
                        if(this.num>6) this.num = 1
                        imgObj.src = `./img/img${this.num}.jpg`
                    },1000)
                    
                }

                //移入改变
                yrgb() {
                    let liObj = this.el.querySelectorAll('li')
                    liObj.forEach((item,index) => {
                        item.onmouseover = () => {
                            clearInterval(this.timer);
                            this.el.querySelector('img').src = "./img/img"+(index+1)+".jpg"
                            this.num = index+1
                        }
                        
                        item.onmouseout = () => {
                            this.gbtp()
                        }
                    })
                }
                
            }

            console.log(lunbotu)
            
            let lllbbbttt = new lunbotu('.lbt')
            let lllbbbttt2 = new lunbotu('.lbt2')
            
            


            // Swiper- prototype.init = function()
            //     //越细越好

            //     //this == lbt1\lbt2
            //     // 同步配置文件
            //     this.defaultConfig()
            //     // 自动切换
            //     this.changeImg(
            //     // 同步圆圈
            //     this.tbyq()
            //     // 移入移出
            //     this.yqOverOut()
            // }
        </script>
    </body>
</html>